package top.kaoshanji.ch04.statics;

/**
 * author kaoshanji
 * ^_^
 *
 * @version 0.0.1
 * ^_^
 * create time 2024/11/25 10:19
 */
public class Employee {

    // 这是一个静态字段
    private static int nextId = 1;

    private String name;
    private double salary;
    private int id;

    public Employee(String n, double s) {
        this.name = n;
        this.salary = s;
        id = 0;
    }

    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }

    public int getId() {
        return id;
    }

    public void setId() {
        id = nextId;
        nextId++;
    }

    public static int getNextId() {
        return nextId;
    }
}
